Skip to content

List page: relationship cell labels via the shared label seam#639

Merged
borisno2 merged 1 commit into
mainfrom
claude/issue-632-v6spq0
Jul 10, 2026
Merged

List page: relationship cell labels via the shared label seam#639
borisno2 merged 1 commit into
mainfrom
claude/issue-632-v6spq0

Conversation

@borisno2

Copy link
Copy Markdown
Member

Summary

  • ListView (the built-in admin list page's server component) now resolves each relationship cell value to { id, label } via the shared label seam (getItemLabel) before it crosses the server/client boundary to ListViewClient — honouring a related list's configured ui.labelField, and matching the same resolver already used for relationship-option labels in the item edit form (relationship-options.ts).
  • Removed the drifted inline name → title → label → id derivation (getRelationshipDisplayValue) from packages/ui/src/lib/utils.ts. getFieldDisplayValue no longer special-cases 'relationship' — that display logic now depends on a related list's config, which only the server component has.
  • The standalone ListTable component (embedded directly by consumers with raw items and no list config) keeps its own local, unexported fallback for relationship display, since it never had access to any list config to resolve ui.labelField against. This keeps it working without depending on the now-removed shared chain in utils.ts.
  • Existing list-view behaviour is preserved: empty relationship shows a dash, many-relationships render as comma-separated links.

Test plan

  • Added packages/ui/tests/components/ListView.test.tsx covering: default name fallback, a configured ui.labelField, many-relationships resolving to an array of { id, label }, falling back to id when the label field is stripped (e.g. by access control), and null/empty relationships resolving to null.
  • Updated packages/ui/tests/components/ListViewClient.test.tsx relationship fixtures to the new pre-resolved { id, label } shape.
  • pnpm test in packages/ui — 215 tests passing.
  • pnpm build in packages/ui — typechecks cleanly.
  • pnpm lint — no new warnings/errors.
  • Changeset added (@opensaas/stack-ui patch).

Closes #632


Generated by Claude Code

…label seam

ListView now resolves each relationship value to { id, label } server-side
via getItemLabel (honouring a related list's ui.labelField) before crossing
the server/client boundary, instead of ListViewClient/utils.ts deriving a
label from an inline name → title → label → id chain that had drifted from
the item form's relationship-option labels.

Closes #632
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stack-docs Ready Ready Preview, Comment Jul 10, 2026 9:13am

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d22508d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@opensaas/stack-ui Patch
@opensaas/stack-tiptap Patch
@opensaas/stack-auth Patch
@opensaas/stack-cli Patch
@opensaas/stack-core Patch
@opensaas/stack-rag Patch
@opensaas/stack-storage-s3 Patch
@opensaas/stack-storage-vercel Patch
@opensaas/stack-storage Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Member Author

Self-review

Reviewed the diff for correctness and scope against the acceptance criteria in #632.

Findings: none blocking.

Design notes for reviewers:

  • ListView.tsx (server component, has full OpenSaasConfig) now resolves each relationship value to { id, label } via getItemLabel(relatedListConfig, row) before the props cross into the 'use client' ListViewClient — a real ListConfig object can't be passed as a client-component prop (it carries functions), so resolution has to happen server-side, mirroring the existing pattern in packages/core/src/query/relationship-options.ts.
  • The drifted inline name → title → label → id chain (getRelationshipDisplayValue) is removed from the shared packages/ui/src/lib/utils.ts, per the acceptance criteria.
  • The standalone ListTable component (embedded directly by consumers with raw items and no list config at all) can't call getItemLabel — it has no ListConfig to resolve against. It keeps a local, unexported copy of the old fallback chain scoped to that one file, so it can't drift against anything else. This is intentionally out of scope of List page: relationship cell labels via the shared label seam #632 (which is about the list page, i.e. ListView/ListViewClient), and its existing tests/behavior are unchanged.
  • Edge case worth flagging: if a relationship ref points at a list key missing from config.lists (a config error), the cell now silently renders a dash rather than showing raw data — a defensive fallback, not a behavior a correctly configured app would hit.

Verification:

  • pnpm test (packages/ui): 215/215 passing, including new coverage in ListView.test.tsx for the default name fallback, a configured ui.labelField, many-relationships, missing-label-field fallback to id, and null/empty relationships.
  • pnpm build (packages/ui): typechecks cleanly.
  • pnpm lint / pnpm format / pnpm manypkg fix: no new warnings, no diffs.

Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for Core Package Coverage (./packages/core)

Status Category Percentage Covered / Total
🔵 Lines 92.22% (🎯 65%) 901 / 977
🔵 Statements 91.56% (🎯 65%) 945 / 1032
🔵 Functions 98.05% (🎯 62%) 151 / 154
🔵 Branches 80.92% (🎯 50%) 615 / 760
File CoverageNo changed files found.
Generated in workflow #1237 for commit d22508d by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for UI Package Coverage (./packages/ui)

Status Category Percentage Covered / Total
🔵 Lines 86.79% 92 / 106
🔵 Statements 87.15% 95 / 109
🔵 Functions 79.48% 31 / 39
🔵 Branches 78.94% 75 / 95
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/ui/src/lib/utils.ts 8.33% 0% 16.66% 8.33% 15-51
Generated in workflow #1237 for commit d22508d by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for CLI Package Coverage (./packages/cli)

Status Category Percentage Covered / Total
🔵 Lines 79.21% 1490 / 1881
🔵 Statements 78.92% 1550 / 1964
🔵 Functions 84.45% 201 / 238
🔵 Branches 67.25% 653 / 971
File CoverageNo changed files found.
Generated in workflow #1237 for commit d22508d by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for Auth Package Coverage (./packages/auth)

Status Category Percentage Covered / Total
🔵 Lines 74.64% 159 / 213
🔵 Statements 69.74% 166 / 238
🔵 Functions 83.11% 64 / 77
🔵 Branches 70.67% 94 / 133
File CoverageNo changed files found.
Generated in workflow #1237 for commit d22508d by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for Storage Package Coverage (./packages/storage)

Status Category Percentage Covered / Total
🔵 Lines 74.8% 190 / 254
🔵 Statements 76.44% 211 / 276
🔵 Functions 85.89% 67 / 78
🔵 Branches 70.73% 174 / 246
File CoverageNo changed files found.
Generated in workflow #1237 for commit d22508d by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for RAG Package Coverage (./packages/rag)

Status Category Percentage Covered / Total
🔵 Lines 47.97% 355 / 740
🔵 Statements 48.14% 377 / 783
🔵 Functions 54.26% 70 / 129
🔵 Branches 42.55% 180 / 423
File CoverageNo changed files found.
Generated in workflow #1237 for commit d22508d by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for Storage S3 Package Coverage (./packages/storage-s3)

Status Category Percentage Covered / Total
🔵 Lines 100% 40 / 40
🔵 Statements 100% 40 / 40
🔵 Functions 100% 9 / 9
🔵 Branches 100% 19 / 19
File CoverageNo changed files found.
Generated in workflow #1237 for commit d22508d by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for Storage Vercel Package Coverage (./packages/storage-vercel)

Status Category Percentage Covered / Total
🔵 Lines 100% 38 / 38
🔵 Statements 100% 38 / 38
🔵 Functions 100% 8 / 8
🔵 Branches 100% 22 / 22
File CoverageNo changed files found.
Generated in workflow #1237 for commit d22508d by the Vitest Coverage Report Action

@borisno2 borisno2 merged commit 3b2beb7 into main Jul 10, 2026
6 checks passed
@borisno2 borisno2 deleted the claude/issue-632-v6spq0 branch July 10, 2026 13:01
@github-actions github-actions Bot mentioned this pull request Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List page: relationship cell labels via the shared label seam

2 participants